    <div id="wrapper">
        <!--左侧导航开始-->
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="nav-close"><i class="fa fa-times-circle"></i>
            </div>
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header">
                        <div class="dropdown profile-element">
                            <span><img alt="image" class="img-circle" src="__ROOT__/Uploads/{$_SESSION['admin_img']}" onerror="this.src='__PUBLIC__/Admin/img/touxiang_default.gif'" width="70px" height="70px"/></span>
                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">
                               <span class="block m-t-xs"><strong>{$_SESSION['admin_realname']}</strong></span>
                                <span class="text-muted text-xs block">
                                    {$admin_group.title}
                                	<b class="caret"></b></span>
                                </span>
                            </a>
                            <ul class="dropdown-menu animated fadeInRight m-t-xs">
                                <li><a href="{:U('Sys/pwd')}">修改密码</a></li>
                                <li><a href="javascript:;" id="cache">清除缓存</a></li>
                                <li><a href="{:U('Sys/sys')}">设置</a></li>
                                <li class="divider"></li>
                                <li><a href="javascript:;" id="logout">退出系统</a></li>
                            </ul>
                        </div>
                        <div class="logo-element">挪窝</div>
                    </li>
                    <li>
                        <a class="J_menuItem" href="{:U(Index/index)}"><i class="fa fa-home"></i> <span class="nav-label">主页</span>
                        <span class="label label-danger pull-right">NEW</span></a>
                    </li>

<php>
use Common\Controller\AuthController;
use Think\Auth;
		$m = M('auth_rule');
		$field = 'id,name,title,css';
	    $data = $m->field($field)->where('pid=0 AND status=1')->order('sort')->select();	   
	    $auth = new Auth();
	    //没有权限的菜单不显示
    	foreach ($data as $k=>$v){
    		if(!$auth->check($v['name'], $_SESSION['aid']) && $_SESSION['aid'] != 1){
    			unset($data[$k]);
    		}
	    }

</php>

	<foreach name="data" item="v">
			<li class="<if condition="CONTROLLER_NAME eq $v['name']">active</if>"><!--open代表打开状态-->
				<a href="#">
					<i class="menu-icon fa {$v.css}"></i>
					<span class="nav-label">{$v.title}</span><span class="fa arrow"></span>
				</a>

			<ul class="nav nav-second-level">
    <php>
		$m = M('auth_rule');
	    $dataa = $m->where(array('pid'=>$v['id'],'status'=>1))->order('sort')->select();
    	foreach ($dataa as $kk=>$vv){
    		if(!$auth->check($vv['name'], $_SESSION['aid']) && $_SESSION['aid'] != 1){
    			unset($dataa[$kk]);
    		}
	    }
	
    </php>
		    <foreach name="dataa" item="j">
					<li class=" <if condition="($_SESSION['se'] eq $j['id'])">active</if>">
						<a href="{:U($j['name'],array('se'=>$j['id']))}">{$j.title}</a>						
					</li>
			</foreach>
			</ul>
		</li>
	</foreach>

        </ul>
    </div>
</nav>
<script type="text/javascript">
$(document).ready(function(){
    $("#logout").click(function(){
        layer.confirm('你确定要退出吗？', {icon: 3}, function(index){
        layer.close(index);
        window.location.href="{:U('Login/logout')}";
    });
    });
});



    $(function(){
        $("#cache").click(function(){
            layer.confirm('你确定要清除缓存吗？', {icon: 3}, function(index){
                layer.close(index);
                window.location.href="{:U('Sys/clearRuntime')}";
            });
        });
    });

    
</script>

    <div id="page-wrapper" class="gray-bg dashbard-1">
    <include file="Public:top" />
